package org.TCP;

import java.io.IOException;
import java.io.OutputStream;
import java.net.DatagramSocket;
import java.net.Socket;
//TCP发送端
public class SendMassage {
    public static void main(String[] args) throws IOException {
        //创建一个Socket对象
        Socket socket = new Socket("127.0.0.1", 10086);
        //获取输出流
        OutputStream os = socket.getOutputStream();
        //发送数据  变成直接数组再发
        os.write("hello".getBytes());
        //关闭输出流
        os.close();
        //关闭Socket
        socket.close();


    }
}
